#include "MessageMove.h"
#include "MessagesDefs.h"




MessageMove::MessageMove(std::string id)
:	Message(MessagesDefs::k_MESSAGE_LOGIN, id)
{	
	//setData(0, 0, 0, 0, 0);
}

MessageMove::~MessageMove()
{

}

void MessageMove::setData(double forceX, double forceY, double posX, double posY, double rotation)
{
	m_data->seek(MSG_OFFSET_ID);
	m_data->readUTF(); // Skip id

	//m_data->writeInt(forceX);
	/*m_data->writeInt(forceY);
	m_data->writeInt(posX);
	m_data->writeInt(posY);
	m_data->writeInt(rotation);	*/
}

double MessageMove::getPosX()
{
	m_data->seek(MSG_OFFSET_ID);
	m_data->readDouble();	// Skip force x;
	m_data->readDouble();	// Skip force y;
	
	return m_data->readDouble();
}

double MessageMove::getPosY()
{
	m_data->seek(MSG_OFFSET_ID);
	m_data->readDouble();	// Skip force x;
	m_data->readDouble();	// Skip force y;
	m_data->readDouble();	// Skip pos x;
	
	return m_data->readDouble();
}

int MessageMove::getRotation()
{
	m_data->seek(MSG_OFFSET_ID);
	m_data->readDouble();	// Skip force x;
	m_data->readDouble();	// Skip force y;
	m_data->readDouble();	// Skip pos x;
	m_data->readDouble();	// Skip pos y;
	
	return m_data->readInt();
}